<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<title>可见元素的样式设置</title>
		<link rel="stylesheet" type="text/css" href="css/txt.css" />
		<script src="js/jquery.js" type="text/javascript" charset="utf-8"></script>
	</head>

	<body>

		<div>1. 我是可见性的元素</div>
		<span style="display:block">2. 我是可见性的元素</span>
		<div style="display:none">3. 我是不可见性的元素</div>

	</body>

	<script type="text/javascript">
		$(function() {
			// 设置可见性元素的样式
			$("div:visible").attr("class","txt");
			$("span:visible").attr("class","txt");
			
		});
	</script>

</html>